import java.util.*;
import java.io.*;

public class test {
    public static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();
    // 蓝桥杯 夏令时记录(⭐⭐)
    public static void main(String[] args) throws IOException {
        int a = 31;
        int n = in.nextInt();
        int q = in.nextInt();
        int[] arr = new int[n + 1];
        long[] sum = new long[n + 1];
        long[] ih = new long[n + 1];
        for(int i = 1;i <= n;i++){
            arr[i] = in.nextInt();
            sum[i] = sum[i - 1] + arr[i];
            ih[i] = ih[i - 1] ^ arr[i];
        }
        while(q-- > 0){
            int l = in.nextInt();
            int r = in.nextInt();
            long num1 = sum[r] - sum[l - 1];
            long num2 = ih[r] ^ ih[l - 1];
            if(num1 == num2) System.out.println("YES");
            else System.out.println("NO");
        }
    }
    // 蓝桥杯 k倍区间(⭐⭐)
    public static void main1(String[] args) throws IOException {
        int n = in.nextInt();
        int k = in.nextInt();
        int[] arr = new int[n + 1];
        long[] sum = new long[n + 1];
        HashMap<Long,Integer> map = new HashMap<>();
        map.put(0L,1);
        long max = 0;
        for(int i = 1;i <= n;i++){
            arr[i] = in.nextInt();
            sum[i] = sum[i - 1] + arr[i];
            long a = sum[i] % k;
            max += map.getOrDefault(a,0);
            map.put(a,map.getOrDefault(a,0) + 1);
        }
        System.out.println(max);
    }
    // 蓝桥杯 恒纪元(⭐⭐⭐)
    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int y = in.nextInt();
        int z = in.nextInt();
        int q = in.nextInt();
        HashSet<Long> set = new HashSet<>();
        for(long i = 0;i < 60;i++){
            for(long j = 0;j < 60;j++){
                for(long k = 0;k < 60;k++){
                    set.add((long)(Math.pow(x, i) + Math.pow(y, j) + Math.pow(z, k)));
                }//set.add((long)(Math.pow(x, i) + Math.pow(y, j) + Math.pow(z, k)));
            }
        }
        ArrayList<Long> list = new ArrayList<>(set);
        Collections.sort(list);
        while(q-- > 0){
            long s = in.nextLong();
            int l = 0,r = list.size() - 1;
            int index = 0;
            while(l <= r){
                int mid = l + (r - l) / 2;
                if(list.get(mid) > s){
                    r = mid - 1;
                }else if(list.get(mid) < s){
                    l = mid + 1;
                }else {
                    index = mid;
                    break;
                }
            }
            //记录当前的乱纪元的下标
            long nextYear = list.get(index);
            //找到下一个恒纪元(乱纪元里没有就继续找)
            while(list.contains(nextYear)){
                nextYear++;
                //index++代表不断移动的乱纪元下标
                index++;
                //System.out.println("nextYear:" + nextYear + " index:" + index);
            }
            long luan = list.get(index);
            System.out.println(nextYear + " " + (luan - nextYear));
        }
    }
    // 蓝桥杯 星辰能量(⭐⭐)
    public static int sum;
    public static int[] arr;
    public static void main3(String[] args) throws IOException {
        int t = in.nextInt();
        while(t-- > 0){
            int n = in.nextInt();
            arr = new int[n];
            for(int i = 0;i < n;i++){
                arr[i] = in.nextInt();
            }
            dfs(5,n);
            System.out.println(sum);
            sum = 0;
        }
    }
    public static void dfs(int num,int len){
        int path = 0;
        for(int i = 0;i < len;i++){
            if(arr[i] <= 0) {
                path++;
                continue;
            }
        }
        if(path == len){
            sum++;
            return;
        }
        //星辰能量燃尽了
        if(num <= 0){
            return;
        }
        for(int i = 0;i < len;i++){
            if(arr[i] > 0){
                arr[i] -= num;
                dfs(num - 1,len);
                arr[i] += num;
            }
        }
    }
}
class Read{
    StringTokenizer st = new StringTokenizer("");
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String next() throws IOException{
        while(!st.hasMoreTokens()){
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    int nextInt() throws IOException{
        return Integer.parseInt(next());
    }
    long nextLong() throws IOException{
        return Long.parseLong(next());
    }
    double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }
}